#include<iostream>
#include<thread>
#include<future>

void Add(int num1,int num2,std::promise<int>&prom)
{
    prom.set_value(num1+num2);
}

int main()
{
    std::promise<int> prom;

    std::future<int> fu=prom.get_future();

    std::thread th(Add,11,22,std::ref(prom));

    int ret=fu.get();
    std::cout<<ret<<std::endl;
    th.join();
    return 0;
}